﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
//using System.Linq;
using System.Text;
using System.Windows.Forms;
//new
using Microsoft.Win32;
using MyRegester;

namespace JKZP
{
    public partial class RegForm : Form
    {
        public RegForm()
        {
            InitializeComponent();
        }

        private void RegForm_Load(object sender, EventArgs e)
        {
            if (PP.gLocalIP != "")
            {
                textBox_mc.Text = RegMgr.m_MachineCode;
            }
            if (PP.gSoftRegstor)
            {
                label_state.Text = "已注册";
                this.textBox_code.Text = RegMgr.m_RegCode;
                this.button_save.Enabled = false;
            }
            else
            {
                label_state.Text = "未注册";
                this.textBox_code.Text = "";
            }
        }

        private void button_save_Click(object sender, EventArgs e)
        {
            try
            {
                if (RegMgr.SetSN(textBox_code.Text) == true)
                {
                    PP.gSoftRegstor = true;
                    label_state.Text = "注册成功";
                }
                else
                {
                    PP.gSoftRegstor = false;
                    label_state.Text = "注册失败";
                }
            }
            catch
            { }
        }

        private void button_exit_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
